#ifndef FORM_DEPT_H
#define FORM_DEPT_H

#include <QWidget>
#include <QJsonObject>
#include <QJsonArray>
#include <QSqlQuery>
#include <QMap>
#include <QSqlQueryModel>
#include <QTimer>

namespace Ui {
class Form_dept;
}

class Form_dept : public QWidget
{
    Q_OBJECT

public:
    explicit Form_dept(QWidget *parent = nullptr);
    ~Form_dept();
    void closeEvent(QCloseEvent *event);

signals:
    void destroyW( QString );

private slots:
    void tm_init_out();
    void clear_form();

    void on_pb_exit_clicked();

    void on_pb_fresh_clicked();

    void on_tv_dept_list_clicked(const QModelIndex &index);

    void on_tv_dept_list_doubleClicked(const QModelIndex &index);

    void on_pb_new_clicked();

    void on_pb_save_clicked();

    void on_le_default_diag_textChanged(const QString &arg1);

private:
    Ui::Form_dept *ui;

    QSqlQuery *qrm, *qro, *qrot;
    //QSqlQueryModel mdList ;//
    QString sq;
    QSqlQueryModel *md;

    QString dept_types;

    bool initialized;   //form initialize finish flag

    bool is_new;    //if the dept is new created.

    QTimer *tm_init;

};

#endif // FORM_DEPT_H
